<template>
    <div>
        <p><input type="text" v-model="name"> <button @click="getRecord">搜索</button></p>
        <table v-show="is_userList" border="1" align="center" width="800px">
            <tr>
                <td>名称</td>
                <td>打卡日期</td>
                <td>上班时间</td>
                <td>下班时间</td>
                <td>积分变化</td>
            </tr>
            <tr v-for="record in recordList">
                <td>{{record.name}}</td>
                <td>{{record.start}}</td>
                <td>{{record.start}}</td>
                <td>{{record.end}}</td>
                <td>{{record.total | total}}</td>
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        name: "record_sector",
        data() {
            return {
                name: '',
                recordList: [],
                is_userList: false,
            }
        },
        methods: {
            getRecord(){
                this.is_userList = true;
                this.$axios({
                    url: 'sector/record/',
                    params: {
                        name: this.name
                    }
                }).then(resp=>{
                    console.log(resp.data)
                    this.recordList = resp.data
                })
            }
        },
        computed: {},
        filters: {
            total(x){
                if (x){
                    return '+' + x
                }else{
                    return '+' + 0
                }
            }
        },
        watch: {},
    }
</script>

<style scoped>

</style>
